{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7a46ee9f",
   "metadata": {},
   "source": [
    "----\n",
    "* 2022/09/06/week03    \n",
    "* python 课堂笔记"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4c3014cf",
   "metadata": {},
   "source": [
    "# 知识点    \n",
    "> 1. 回顾变量的概念\n",
    "> 2. if条件\n",
    "> 3."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "057da9e7",
   "metadata": {},
   "source": [
    "## 1.回顾变量的概念"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3742d208",
   "metadata": {},
   "outputs": [],
   "source": [
    "网新_01_ID = \"21000001\"      \n",
    "\n",
    "网新_02_ID = \"21000002\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "30d24254",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'21000001'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网新_01_ID"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "8bb09542",
   "metadata": {},
   "outputs": [],
   "source": [
    "田柾国_aka = \"脸蛋天才\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a54a8a6e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'脸蛋天才'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "田柾国_aka"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c0ba653c",
   "metadata": {},
   "source": [
    "## 2.条件判断     "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "ae83bce9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2022, 9, 6)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import datetime     \n",
    "datetime.date.today()   \n",
    "# datetime可以获取到年月日，但好像不能获取到星期几？？？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d29f5887",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import time   \n",
    "time.localtime().tm_wday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "f1bf8680",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "上课上课读书人\n"
     ]
    }
   ],
   "source": [
    "# 创建today变量(通过模块获取今天星期几几？)    \n",
    "# 知识点： 1. 先创建变量，才能进行判断      \n",
    "#          2. if语句\n",
    "today = \"Saturday\"\n",
    "condition = \"Headache\"\n",
    "\n",
    "if today == \"Saturady\":    \n",
    "    print(\"放假放假~\")\n",
    "elif today == \"Sunday\":\n",
    "    if condition == \"Headache\":\n",
    "        print(\"休息\")\n",
    "    else:\n",
    "        print(\"rest\")\n",
    "else:\n",
    "    print(\"上课上课读书人\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "f58e0470",
   "metadata": {},
   "outputs": [],
   "source": [
    "# wkday = 0,1,2,3,4,5,6, \n",
    "import time\n",
    "\n",
    "wday = time.localtime().tm_wday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "43b59ea5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "13"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime().tm_hour"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "ffeb3273",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "12"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime().tm_min"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "58af6b6d",
   "metadata": {},
   "source": [
    "# 课本P43实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "0d0fbd93",
   "metadata": {},
   "outputs": [
    {
     "ename": "IndentationError",
     "evalue": "unexpected indent (2860674856.py, line 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Input \u001b[1;32mIn [104]\u001b[1;36m\u001b[0m\n\u001b[1;33m    print(\"今天没有python课\")\u001b[0m\n\u001b[1;37m    ^\u001b[0m\n\u001b[1;31mIndentationError\u001b[0m\u001b[1;31m:\u001b[0m unexpected indent\n"
     ]
    }
   ],
   "source": [
    "if wday != 1: ()\n",
    "    print(\"今天没有python课\")\n",
    "elif time_hour == 12 and time_min > 50:\n",
    "            print(\"谁懂，刚上课\")\n",
    "elif time_hour == 13:\n",
    "            print(\"现在第二节课\")\n",
    "elif time_hour == 14:\n",
    "            print(\"第三节\")\n",
    "elif time_hour == 15:\n",
    "            print(\"第四节啊啊啊\")\n",
    "elif time_hour == 16 and time_min < 50:\n",
    "            print(\"最后一节课\")\n",
    "else:\n",
    "    print(\"今天有python课，上课时间是下午12:20-16:50\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a35a486b",
   "metadata": {},
   "source": [
    "## 4. for循环和range方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "id": "1594db6e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "# item 循环遍历\n",
    "for item in [1,2,3]:\n",
    "    print(item)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "id": "395da8c9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2100001\n",
      "2100002\n",
      "2100003\n"
     ]
    }
   ],
   "source": [
    "# 自动生成学号\n",
    "for item in [1,2,3]:\n",
    "    print(item+2100000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "0b98fdad",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "#  range()自动生成想要的数值，可以控制for循环的次数，一个值，就是从0开始几个数\n",
    "for num in range(5):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "id": "f4dd06b1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "# range()自动生成想要的数值，可以控制for循环的次数，两个值，从小数（2）开始，大数-小数的个数（5-2）\n",
    "for num in range(2,5):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "id": "16187253",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "3\n",
      "6\n",
      "9\n"
     ]
    }
   ],
   "source": [
    "# 三个值，第三个值决定step步长\n",
    "for num in range(0,10,3):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "id": "fa84fe8a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "https://www.nfu.edu.cn/ztb/index0.htm\n",
      "https://www.nfu.edu.cn/ztb/index1.htm\n",
      "https://www.nfu.edu.cn/ztb/index2.htm\n",
      "https://www.nfu.edu.cn/ztb/index3.htm\n",
      "https://www.nfu.edu.cn/ztb/index4.htm\n",
      "https://www.nfu.edu.cn/ztb/index5.htm\n",
      "https://www.nfu.edu.cn/ztb/index6.htm\n",
      "https://www.nfu.edu.cn/ztb/index7.htm\n",
      "https://www.nfu.edu.cn/ztb/index8.htm\n",
      "https://www.nfu.edu.cn/ztb/index9.htm\n",
      "https://www.nfu.edu.cn/ztb/index10.htm\n",
      "https://www.nfu.edu.cn/ztb/index11.htm\n",
      "https://www.nfu.edu.cn/ztb/index12.htm\n",
      "https://www.nfu.edu.cn/ztb/index13.htm\n",
      "https://www.nfu.edu.cn/ztb/index14.htm\n",
      "https://www.nfu.edu.cn/ztb/index15.htm\n",
      "https://www.nfu.edu.cn/ztb/index16.htm\n",
      "https://www.nfu.edu.cn/ztb/index17.htm\n",
      "https://www.nfu.edu.cn/ztb/index18.htm\n",
      "https://www.nfu.edu.cn/ztb/index19.htm\n",
      "https://www.nfu.edu.cn/ztb/index20.htm\n",
      "https://www.nfu.edu.cn/ztb/index21.htm\n",
      "https://www.nfu.edu.cn/ztb/index22.htm\n",
      "https://www.nfu.edu.cn/ztb/index23.htm\n",
      "https://www.nfu.edu.cn/ztb/index24.htm\n",
      "https://www.nfu.edu.cn/ztb/index25.htm\n",
      "https://www.nfu.edu.cn/ztb/index26.htm\n"
     ]
    }
   ],
   "source": [
    "# for循环遍历案例 ： 某学校新闻网站数据URL队列获取\n",
    "\n",
    "# 中大南方-招投标- https://www.nfu.edu.cn/ztb/index.htm\n",
    "\n",
    "中大南方_招投标 = \"https://www.nfu.edu.cn/ztb/index.htm\"\n",
    "for page in range(27):\n",
    "    print(\"https://www.nfu.edu.cn/ztb/index\" + str(page) + \".htm\" )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "328bd75c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in (1,2,3):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "a8cf45c3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "H\n",
      "i\n",
      "!\n"
     ]
    }
   ],
   "source": [
    "for ch in \"Hi!\":\n",
    "    print(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "db4969b6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heas First Rocks!\n",
      "Heas First Rocks!\n",
      "Heas First Rocks!\n",
      "Heas First Rocks!\n",
      "Heas First Rocks!\n"
     ]
    }
   ],
   "source": [
    "for num in range(5):\n",
    "    print(\"Heas First Rocks!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a546eb28",
   "metadata": {},
   "source": [
    "### range实验"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "edc1b525",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for num in range(5):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "845f806c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "2\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for num in range(0,5,2):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "47824603",
   "metadata": {},
   "outputs": [],
   "source": [
    "for num in range(0,10,-2):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "223eae0c",
   "metadata": {},
   "source": [
    "## 5. random模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "e2f85d12",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "6338659c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.13561453032832893"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# random.random方法：取（0,1）\n",
    "random.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "1957b5f3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# random.random(a,b),随机生成a-b之间的一个数值\n",
    "random.randint(1,50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "b9cfe10e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "3\n",
      "3\n",
      "4\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(random.randint(1,6))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c615d69e",
   "metadata": {},
   "source": [
    "# 课本P35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "8bf27a17",
   "metadata": {},
   "outputs": [],
   "source": [
    "# help(random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "a72b30ce",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "8e21c301",
   "metadata": {},
   "outputs": [],
   "source": [
    "time.sleep(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "3df74360",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "right_this_minute = datetime.datetime.today().second\n",
    "\n",
    "for i in range(5):\n",
    "    if right_this_minute in odds:\n",
    "        print(right_this_minute)\n",
    "        print(\"现在秒/时间为奇数\")\n",
    "    else:\n",
    "        print(right_this_minute)\n",
    "        print(\"现在时间为偶数\")\n",
    "    time.sleep(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "5364e6dc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n",
      "53\n",
      "现在秒/时间为奇数\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "right_this_minute = datetime.datetime.today().second\n",
    "\n",
    "for i in range(5):\n",
    "    if right_this_minute in odds:\n",
    "        print(right_this_minute)\n",
    "        print(\"现在秒/时间为奇数\")\n",
    "    else:\n",
    "        print(right_this_minute)\n",
    "        print(\"现在时间为偶数\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "92b5def0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "16\n",
      "现在时间为偶数\n",
      "18\n",
      "现在时间为偶数\n",
      "23\n",
      "现在秒/时间为奇数\n",
      "29\n",
      "现在秒/时间为奇数\n",
      "30\n",
      "现在时间为偶数\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "import time\n",
    "import random\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "right_this_minute = datetime.datetime.today().second\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.datetime.today().second\n",
    "    if right_this_minute in odds:\n",
    "        print(right_this_minute)\n",
    "        print(\"现在秒/时间为奇数\")\n",
    "    else:\n",
    "        print(right_this_minute)\n",
    "        print(\"现在时间为偶数\")\n",
    "    time.sleep(random.randint(1,6))\n",
    "# 爬虫，爬数据，每隔五秒抓一次数据\n",
    "#反爬虫，随机\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "e9632101",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 bottles of beer on the wall.\n",
      "99 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "98 bottles of beer on the wall.\n",
      "\n",
      "98 bottles of beer on the wall.\n",
      "98 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "97 bottles of beer on the wall.\n",
      "\n",
      "97 bottles of beer on the wall.\n",
      "97 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "96 bottles of beer on the wall.\n",
      "\n",
      "96 bottles of beer on the wall.\n",
      "96 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "95 bottles of beer on the wall.\n",
      "\n",
      "95 bottles of beer on the wall.\n",
      "95 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "94 bottles of beer on the wall.\n",
      "\n",
      "94 bottles of beer on the wall.\n",
      "94 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "93 bottles of beer on the wall.\n",
      "\n",
      "93 bottles of beer on the wall.\n",
      "93 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "92 bottles of beer on the wall.\n",
      "\n",
      "92 bottles of beer on the wall.\n",
      "92 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "91 bottles of beer on the wall.\n",
      "\n",
      "91 bottles of beer on the wall.\n",
      "91 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "90 bottles of beer on the wall.\n",
      "\n",
      "90 bottles of beer on the wall.\n",
      "90 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "89 bottles of beer on the wall.\n",
      "\n",
      "89 bottles of beer on the wall.\n",
      "89 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "88 bottles of beer on the wall.\n",
      "\n",
      "88 bottles of beer on the wall.\n",
      "88 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "87 bottles of beer on the wall.\n",
      "\n",
      "87 bottles of beer on the wall.\n",
      "87 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "86 bottles of beer on the wall.\n",
      "\n",
      "86 bottles of beer on the wall.\n",
      "86 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "85 bottles of beer on the wall.\n",
      "\n",
      "85 bottles of beer on the wall.\n",
      "85 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "84 bottles of beer on the wall.\n",
      "\n",
      "84 bottles of beer on the wall.\n",
      "84 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "83 bottles of beer on the wall.\n",
      "\n",
      "83 bottles of beer on the wall.\n",
      "83 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "82 bottles of beer on the wall.\n",
      "\n",
      "82 bottles of beer on the wall.\n",
      "82 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "81 bottles of beer on the wall.\n",
      "\n",
      "81 bottles of beer on the wall.\n",
      "81 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "80 bottles of beer on the wall.\n",
      "\n",
      "80 bottles of beer on the wall.\n",
      "80 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "79 bottles of beer on the wall.\n",
      "\n",
      "79 bottles of beer on the wall.\n",
      "79 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "78 bottles of beer on the wall.\n",
      "\n",
      "78 bottles of beer on the wall.\n",
      "78 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "77 bottles of beer on the wall.\n",
      "\n",
      "77 bottles of beer on the wall.\n",
      "77 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "76 bottles of beer on the wall.\n",
      "\n",
      "76 bottles of beer on the wall.\n",
      "76 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "75 bottles of beer on the wall.\n",
      "\n",
      "75 bottles of beer on the wall.\n",
      "75 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "74 bottles of beer on the wall.\n",
      "\n",
      "74 bottles of beer on the wall.\n",
      "74 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "73 bottles of beer on the wall.\n",
      "\n",
      "73 bottles of beer on the wall.\n",
      "73 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "72 bottles of beer on the wall.\n",
      "\n",
      "72 bottles of beer on the wall.\n",
      "72 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "71 bottles of beer on the wall.\n",
      "\n",
      "71 bottles of beer on the wall.\n",
      "71 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "70 bottles of beer on the wall.\n",
      "\n",
      "70 bottles of beer on the wall.\n",
      "70 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "69 bottles of beer on the wall.\n",
      "\n",
      "69 bottles of beer on the wall.\n",
      "69 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "68 bottles of beer on the wall.\n",
      "\n",
      "68 bottles of beer on the wall.\n",
      "68 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "67 bottles of beer on the wall.\n",
      "\n",
      "67 bottles of beer on the wall.\n",
      "67 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "66 bottles of beer on the wall.\n",
      "\n",
      "66 bottles of beer on the wall.\n",
      "66 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "65 bottles of beer on the wall.\n",
      "\n",
      "65 bottles of beer on the wall.\n",
      "65 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "64 bottles of beer on the wall.\n",
      "\n",
      "64 bottles of beer on the wall.\n",
      "64 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "63 bottles of beer on the wall.\n",
      "\n",
      "63 bottles of beer on the wall.\n",
      "63 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "62 bottles of beer on the wall.\n",
      "\n",
      "62 bottles of beer on the wall.\n",
      "62 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "61 bottles of beer on the wall.\n",
      "\n",
      "61 bottles of beer on the wall.\n",
      "61 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "60 bottles of beer on the wall.\n",
      "\n",
      "60 bottles of beer on the wall.\n",
      "60 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "59 bottles of beer on the wall.\n",
      "\n",
      "59 bottles of beer on the wall.\n",
      "59 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "58 bottles of beer on the wall.\n",
      "\n",
      "58 bottles of beer on the wall.\n",
      "58 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "57 bottles of beer on the wall.\n",
      "\n",
      "57 bottles of beer on the wall.\n",
      "57 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "56 bottles of beer on the wall.\n",
      "\n",
      "56 bottles of beer on the wall.\n",
      "56 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "55 bottles of beer on the wall.\n",
      "\n",
      "55 bottles of beer on the wall.\n",
      "55 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "54 bottles of beer on the wall.\n",
      "\n",
      "54 bottles of beer on the wall.\n",
      "54 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "53 bottles of beer on the wall.\n",
      "\n",
      "53 bottles of beer on the wall.\n",
      "53 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "52 bottles of beer on the wall.\n",
      "\n",
      "52 bottles of beer on the wall.\n",
      "52 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "51 bottles of beer on the wall.\n",
      "\n",
      "51 bottles of beer on the wall.\n",
      "51 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "50 bottles of beer on the wall.\n",
      "\n",
      "50 bottles of beer on the wall.\n",
      "50 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "49 bottles of beer on the wall.\n",
      "\n",
      "49 bottles of beer on the wall.\n",
      "49 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "48 bottles of beer on the wall.\n",
      "\n",
      "48 bottles of beer on the wall.\n",
      "48 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "47 bottles of beer on the wall.\n",
      "\n",
      "47 bottles of beer on the wall.\n",
      "47 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "46 bottles of beer on the wall.\n",
      "\n",
      "46 bottles of beer on the wall.\n",
      "46 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "45 bottles of beer on the wall.\n",
      "\n",
      "45 bottles of beer on the wall.\n",
      "45 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "44 bottles of beer on the wall.\n",
      "\n",
      "44 bottles of beer on the wall.\n",
      "44 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "43 bottles of beer on the wall.\n",
      "\n",
      "43 bottles of beer on the wall.\n",
      "43 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "42 bottles of beer on the wall.\n",
      "\n",
      "42 bottles of beer on the wall.\n",
      "42 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "41 bottles of beer on the wall.\n",
      "\n",
      "41 bottles of beer on the wall.\n",
      "41 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "40 bottles of beer on the wall.\n",
      "\n",
      "40 bottles of beer on the wall.\n",
      "40 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "39 bottles of beer on the wall.\n",
      "\n",
      "39 bottles of beer on the wall.\n",
      "39 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "38 bottles of beer on the wall.\n",
      "\n",
      "38 bottles of beer on the wall.\n",
      "38 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "37 bottles of beer on the wall.\n",
      "\n",
      "37 bottles of beer on the wall.\n",
      "37 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "36 bottles of beer on the wall.\n",
      "\n",
      "36 bottles of beer on the wall.\n",
      "36 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "35 bottles of beer on the wall.\n",
      "\n",
      "35 bottles of beer on the wall.\n",
      "35 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "34 bottles of beer on the wall.\n",
      "\n",
      "34 bottles of beer on the wall.\n",
      "34 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "33 bottles of beer on the wall.\n",
      "\n",
      "33 bottles of beer on the wall.\n",
      "33 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "32 bottles of beer on the wall.\n",
      "\n",
      "32 bottles of beer on the wall.\n",
      "32 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "31 bottles of beer on the wall.\n",
      "\n",
      "31 bottles of beer on the wall.\n",
      "31 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "30 bottles of beer on the wall.\n",
      "\n",
      "30 bottles of beer on the wall.\n",
      "30 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "29 bottles of beer on the wall.\n",
      "\n",
      "29 bottles of beer on the wall.\n",
      "29 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "28 bottles of beer on the wall.\n",
      "\n",
      "28 bottles of beer on the wall.\n",
      "28 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "27 bottles of beer on the wall.\n",
      "\n",
      "27 bottles of beer on the wall.\n",
      "27 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "26 bottles of beer on the wall.\n",
      "\n",
      "26 bottles of beer on the wall.\n",
      "26 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "25 bottles of beer on the wall.\n",
      "\n",
      "25 bottles of beer on the wall.\n",
      "25 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "24 bottles of beer on the wall.\n",
      "\n",
      "24 bottles of beer on the wall.\n",
      "24 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "23 bottles of beer on the wall.\n",
      "\n",
      "23 bottles of beer on the wall.\n",
      "23 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "22 bottles of beer on the wall.\n",
      "\n",
      "22 bottles of beer on the wall.\n",
      "22 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "21 bottles of beer on the wall.\n",
      "\n",
      "21 bottles of beer on the wall.\n",
      "21 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "20 bottles of beer on the wall.\n",
      "\n",
      "20 bottles of beer on the wall.\n",
      "20 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "19 bottles of beer on the wall.\n",
      "\n",
      "19 bottles of beer on the wall.\n",
      "19 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "18 bottles of beer on the wall.\n",
      "\n",
      "18 bottles of beer on the wall.\n",
      "18 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "17 bottles of beer on the wall.\n",
      "\n",
      "17 bottles of beer on the wall.\n",
      "17 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "16 bottles of beer on the wall.\n",
      "\n",
      "16 bottles of beer on the wall.\n",
      "16 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "15 bottles of beer on the wall.\n",
      "\n",
      "15 bottles of beer on the wall.\n",
      "15 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "14 bottles of beer on the wall.\n",
      "\n",
      "14 bottles of beer on the wall.\n",
      "14 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "13 bottles of beer on the wall.\n",
      "\n",
      "13 bottles of beer on the wall.\n",
      "13 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "12 bottles of beer on the wall.\n",
      "\n",
      "12 bottles of beer on the wall.\n",
      "12 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "11 bottles of beer on the wall.\n",
      "\n",
      "11 bottles of beer on the wall.\n",
      "11 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "10 bottles of beer on the wall.\n",
      "\n",
      "10 bottles of beer on the wall.\n",
      "10 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "9 bottles of beer on the wall.\n",
      "\n",
      "9 bottles of beer on the wall.\n",
      "9 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "8 bottles of beer on the wall.\n",
      "\n",
      "8 bottles of beer on the wall.\n",
      "8 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "7 bottles of beer on the wall.\n",
      "\n",
      "7 bottles of beer on the wall.\n",
      "7 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "6 bottles of beer on the wall.\n",
      "\n",
      "6 bottles of beer on the wall.\n",
      "6 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "5 bottles of beer on the wall.\n",
      "\n",
      "5 bottles of beer on the wall.\n",
      "5 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "4 bottles of beer on the wall.\n",
      "\n",
      "4 bottles of beer on the wall.\n",
      "4 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "3 bottles of beer on the wall.\n",
      "\n",
      "3 bottles of beer on the wall.\n",
      "3 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "2 bottles of beer on the wall.\n",
      "\n",
      "2 bottles of beer on the wall.\n",
      "2 bottles of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "1 bottle of beer on the wall.\n",
      "\n",
      "1 bottle of beer on the wall.\n",
      "1 bottle of beer.\n",
      "Take one down.\n",
      "Pass it around.\n",
      "No more bottle of beer on the wall.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "word = \"bottles\"\n",
    "\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num,word,\"of beer on the wall.\")\n",
    "    print(beer_num,word,\"of beer.\")\n",
    "    print(\"Take one down.\")\n",
    "    print(\"Pass it around.\")\n",
    "    if beer_num == 1:\n",
    "        print(\"No more bottle of beer on the wall.\")\n",
    "    else:\n",
    "        new_num = beer_num - 1\n",
    "        if new_num == 1:\n",
    "            word = \"bottle\"\n",
    "        print(new_num, word, \"of beer on the wall.\")\n",
    "    print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "e614f4ec",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 bottles 啤酒在墙上\n",
      "99 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "98 bottles 在啤酒墙上\n",
      "\n",
      "98 bottles 啤酒在墙上\n",
      "98 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "97 bottles 在啤酒墙上\n",
      "\n",
      "97 bottles 啤酒在墙上\n",
      "97 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "96 bottles 在啤酒墙上\n",
      "\n",
      "96 bottles 啤酒在墙上\n",
      "96 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "95 bottles 在啤酒墙上\n",
      "\n",
      "95 bottles 啤酒在墙上\n",
      "95 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "94 bottles 在啤酒墙上\n",
      "\n",
      "94 bottles 啤酒在墙上\n",
      "94 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "93 bottles 在啤酒墙上\n",
      "\n",
      "93 bottles 啤酒在墙上\n",
      "93 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "92 bottles 在啤酒墙上\n",
      "\n",
      "92 bottles 啤酒在墙上\n",
      "92 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "91 bottles 在啤酒墙上\n",
      "\n",
      "91 bottles 啤酒在墙上\n",
      "91 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "90 bottles 在啤酒墙上\n",
      "\n",
      "90 bottles 啤酒在墙上\n",
      "90 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "89 bottles 在啤酒墙上\n",
      "\n",
      "89 bottles 啤酒在墙上\n",
      "89 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "88 bottles 在啤酒墙上\n",
      "\n",
      "88 bottles 啤酒在墙上\n",
      "88 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "87 bottles 在啤酒墙上\n",
      "\n",
      "87 bottles 啤酒在墙上\n",
      "87 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "86 bottles 在啤酒墙上\n",
      "\n",
      "86 bottles 啤酒在墙上\n",
      "86 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "85 bottles 在啤酒墙上\n",
      "\n",
      "85 bottles 啤酒在墙上\n",
      "85 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "84 bottles 在啤酒墙上\n",
      "\n",
      "84 bottles 啤酒在墙上\n",
      "84 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "83 bottles 在啤酒墙上\n",
      "\n",
      "83 bottles 啤酒在墙上\n",
      "83 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "82 bottles 在啤酒墙上\n",
      "\n",
      "82 bottles 啤酒在墙上\n",
      "82 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "81 bottles 在啤酒墙上\n",
      "\n",
      "81 bottles 啤酒在墙上\n",
      "81 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "80 bottles 在啤酒墙上\n",
      "\n",
      "80 bottles 啤酒在墙上\n",
      "80 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "79 bottles 在啤酒墙上\n",
      "\n",
      "79 bottles 啤酒在墙上\n",
      "79 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "78 bottles 在啤酒墙上\n",
      "\n",
      "78 bottles 啤酒在墙上\n",
      "78 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "77 bottles 在啤酒墙上\n",
      "\n",
      "77 bottles 啤酒在墙上\n",
      "77 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "76 bottles 在啤酒墙上\n",
      "\n",
      "76 bottles 啤酒在墙上\n",
      "76 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "75 bottles 在啤酒墙上\n",
      "\n",
      "75 bottles 啤酒在墙上\n",
      "75 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "74 bottles 在啤酒墙上\n",
      "\n",
      "74 bottles 啤酒在墙上\n",
      "74 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "73 bottles 在啤酒墙上\n",
      "\n",
      "73 bottles 啤酒在墙上\n",
      "73 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "72 bottles 在啤酒墙上\n",
      "\n",
      "72 bottles 啤酒在墙上\n",
      "72 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "71 bottles 在啤酒墙上\n",
      "\n",
      "71 bottles 啤酒在墙上\n",
      "71 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "70 bottles 在啤酒墙上\n",
      "\n",
      "70 bottles 啤酒在墙上\n",
      "70 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "69 bottles 在啤酒墙上\n",
      "\n",
      "69 bottles 啤酒在墙上\n",
      "69 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "68 bottles 在啤酒墙上\n",
      "\n",
      "68 bottles 啤酒在墙上\n",
      "68 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "67 bottles 在啤酒墙上\n",
      "\n",
      "67 bottles 啤酒在墙上\n",
      "67 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "66 bottles 在啤酒墙上\n",
      "\n",
      "66 bottles 啤酒在墙上\n",
      "66 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "65 bottles 在啤酒墙上\n",
      "\n",
      "65 bottles 啤酒在墙上\n",
      "65 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "64 bottles 在啤酒墙上\n",
      "\n",
      "64 bottles 啤酒在墙上\n",
      "64 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "63 bottles 在啤酒墙上\n",
      "\n",
      "63 bottles 啤酒在墙上\n",
      "63 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "62 bottles 在啤酒墙上\n",
      "\n",
      "62 bottles 啤酒在墙上\n",
      "62 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "61 bottles 在啤酒墙上\n",
      "\n",
      "61 bottles 啤酒在墙上\n",
      "61 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "60 bottles 在啤酒墙上\n",
      "\n",
      "60 bottles 啤酒在墙上\n",
      "60 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "59 bottles 在啤酒墙上\n",
      "\n",
      "59 bottles 啤酒在墙上\n",
      "59 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "58 bottles 在啤酒墙上\n",
      "\n",
      "58 bottles 啤酒在墙上\n",
      "58 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "57 bottles 在啤酒墙上\n",
      "\n",
      "57 bottles 啤酒在墙上\n",
      "57 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "56 bottles 在啤酒墙上\n",
      "\n",
      "56 bottles 啤酒在墙上\n",
      "56 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "55 bottles 在啤酒墙上\n",
      "\n",
      "55 bottles 啤酒在墙上\n",
      "55 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "54 bottles 在啤酒墙上\n",
      "\n",
      "54 bottles 啤酒在墙上\n",
      "54 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "53 bottles 在啤酒墙上\n",
      "\n",
      "53 bottles 啤酒在墙上\n",
      "53 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "52 bottles 在啤酒墙上\n",
      "\n",
      "52 bottles 啤酒在墙上\n",
      "52 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "51 bottles 在啤酒墙上\n",
      "\n",
      "51 bottles 啤酒在墙上\n",
      "51 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "50 bottles 在啤酒墙上\n",
      "\n",
      "50 bottles 啤酒在墙上\n",
      "50 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "49 bottles 在啤酒墙上\n",
      "\n",
      "49 bottles 啤酒在墙上\n",
      "49 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "48 bottles 在啤酒墙上\n",
      "\n",
      "48 bottles 啤酒在墙上\n",
      "48 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "47 bottles 在啤酒墙上\n",
      "\n",
      "47 bottles 啤酒在墙上\n",
      "47 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "46 bottles 在啤酒墙上\n",
      "\n",
      "46 bottles 啤酒在墙上\n",
      "46 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "45 bottles 在啤酒墙上\n",
      "\n",
      "45 bottles 啤酒在墙上\n",
      "45 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "44 bottles 在啤酒墙上\n",
      "\n",
      "44 bottles 啤酒在墙上\n",
      "44 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "43 bottles 在啤酒墙上\n",
      "\n",
      "43 bottles 啤酒在墙上\n",
      "43 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "42 bottles 在啤酒墙上\n",
      "\n",
      "42 bottles 啤酒在墙上\n",
      "42 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "41 bottles 在啤酒墙上\n",
      "\n",
      "41 bottles 啤酒在墙上\n",
      "41 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "40 bottles 在啤酒墙上\n",
      "\n",
      "40 bottles 啤酒在墙上\n",
      "40 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "39 bottles 在啤酒墙上\n",
      "\n",
      "39 bottles 啤酒在墙上\n",
      "39 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "38 bottles 在啤酒墙上\n",
      "\n",
      "38 bottles 啤酒在墙上\n",
      "38 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "37 bottles 在啤酒墙上\n",
      "\n",
      "37 bottles 啤酒在墙上\n",
      "37 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "36 bottles 在啤酒墙上\n",
      "\n",
      "36 bottles 啤酒在墙上\n",
      "36 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "35 bottles 在啤酒墙上\n",
      "\n",
      "35 bottles 啤酒在墙上\n",
      "35 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "34 bottles 在啤酒墙上\n",
      "\n",
      "34 bottles 啤酒在墙上\n",
      "34 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "33 bottles 在啤酒墙上\n",
      "\n",
      "33 bottles 啤酒在墙上\n",
      "33 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "32 bottles 在啤酒墙上\n",
      "\n",
      "32 bottles 啤酒在墙上\n",
      "32 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "31 bottles 在啤酒墙上\n",
      "\n",
      "31 bottles 啤酒在墙上\n",
      "31 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "30 bottles 在啤酒墙上\n",
      "\n",
      "30 bottles 啤酒在墙上\n",
      "30 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "29 bottles 在啤酒墙上\n",
      "\n",
      "29 bottles 啤酒在墙上\n",
      "29 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "28 bottles 在啤酒墙上\n",
      "\n",
      "28 bottles 啤酒在墙上\n",
      "28 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "27 bottles 在啤酒墙上\n",
      "\n",
      "27 bottles 啤酒在墙上\n",
      "27 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "26 bottles 在啤酒墙上\n",
      "\n",
      "26 bottles 啤酒在墙上\n",
      "26 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "25 bottles 在啤酒墙上\n",
      "\n",
      "25 bottles 啤酒在墙上\n",
      "25 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "24 bottles 在啤酒墙上\n",
      "\n",
      "24 bottles 啤酒在墙上\n",
      "24 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "23 bottles 在啤酒墙上\n",
      "\n",
      "23 bottles 啤酒在墙上\n",
      "23 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "22 bottles 在啤酒墙上\n",
      "\n",
      "22 bottles 啤酒在墙上\n",
      "22 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "21 bottles 在啤酒墙上\n",
      "\n",
      "21 bottles 啤酒在墙上\n",
      "21 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "20 bottles 在啤酒墙上\n",
      "\n",
      "20 bottles 啤酒在墙上\n",
      "20 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "19 bottles 在啤酒墙上\n",
      "\n",
      "19 bottles 啤酒在墙上\n",
      "19 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "18 bottles 在啤酒墙上\n",
      "\n",
      "18 bottles 啤酒在墙上\n",
      "18 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "17 bottles 在啤酒墙上\n",
      "\n",
      "17 bottles 啤酒在墙上\n",
      "17 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "16 bottles 在啤酒墙上\n",
      "\n",
      "16 bottles 啤酒在墙上\n",
      "16 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "15 bottles 在啤酒墙上\n",
      "\n",
      "15 bottles 啤酒在墙上\n",
      "15 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "14 bottles 在啤酒墙上\n",
      "\n",
      "14 bottles 啤酒在墙上\n",
      "14 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "13 bottles 在啤酒墙上\n",
      "\n",
      "13 bottles 啤酒在墙上\n",
      "13 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "12 bottles 在啤酒墙上\n",
      "\n",
      "12 bottles 啤酒在墙上\n",
      "12 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "11 bottles 在啤酒墙上\n",
      "\n",
      "11 bottles 啤酒在墙上\n",
      "11 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "10 bottles 在啤酒墙上\n",
      "\n",
      "10 bottles 啤酒在墙上\n",
      "10 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "9 bottles 在啤酒墙上\n",
      "\n",
      "9 bottles 啤酒在墙上\n",
      "9 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "8 bottles 在啤酒墙上\n",
      "\n",
      "8 bottles 啤酒在墙上\n",
      "8 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "7 bottles 在啤酒墙上\n",
      "\n",
      "7 bottles 啤酒在墙上\n",
      "7 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "6 bottles 在啤酒墙上\n",
      "\n",
      "6 bottles 啤酒在墙上\n",
      "6 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "5 bottles 在啤酒墙上\n",
      "\n",
      "5 bottles 啤酒在墙上\n",
      "5 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "4 bottles 在啤酒墙上\n",
      "\n",
      "4 bottles 啤酒在墙上\n",
      "4 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "3 bottles 在啤酒墙上\n",
      "\n",
      "3 bottles 啤酒在墙上\n",
      "3 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "2 bottles 在啤酒墙上\n",
      "\n",
      "2 bottles 啤酒在墙上\n",
      "2 bottles 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "1 bottle 在啤酒墙上\n",
      "\n",
      "1 bottle 啤酒在墙上\n",
      "1 bottle 啤酒\n",
      "拿一瓶\n",
      "传递它\n",
      "没有更多的啤酒在墙上了，这瓶不卖，是拿来观赏的\n",
      "\n"
     ]
    }
   ],
   "source": [
    "word = \"bottles\"\n",
    "\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num, word,\"啤酒在墙上\")\n",
    "    print(beer_num, word,\"啤酒\")\n",
    "    print(\"拿一瓶\")\n",
    "    print(\"传递它\")\n",
    "    if beer_num == 1:\n",
    "        print(\"没有更多的啤酒在墙上了，这瓶不卖，是拿来观赏的\")\n",
    "    else:\n",
    "        new_num = beer_num - 1\n",
    "        if new_num ==1:\n",
    "            word = \"bottle\"\n",
    "        print(new_num, word, \"在啤酒墙上\")\n",
    "    print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "97df76d7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
